var mongoose = require('mongoose')

mongoose.connect('mongodb://localhost/itcast')

var Schema = mongoose.Schema

var storeSchema = new Schema({
    num_store: {
        type: Number,
        required: true
    },
    store_peo: {
        type: Number,
        required: true
    },
    time: {
        type: String,
        required: true
    },
    num_goods: {
        type: Number,
        required: true
    },
    opt_type: {
        type: String,
        required: true
    },
    num: {
        type: Number,
        required: true
    }
})

// var sss = mongoose.model('Store', storeSchema);
// var s1 = new sss({
//     num_store: 9888,
//     store_peo: 02155033,
//     time: '2018年7月2日',
//     num_goods: 9527,
//     opt_type: '增加',
//     num: 999
// })

// s1.save(function(err) {
//     if (err) {
//         console.log(err)
//     } else {
//         console.log('save success!!')
//     }
// })

module.exports = mongoose.model('Store', storeSchema)